package com.xiang.api.config;

import java.util.concurrent.CompletableFuture;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.xiang.sql.service.TaskService;

@Component
public class ScheduledTasks {
  @Autowired
  TaskService taskService;

  @Scheduled(cron = "0 * * * * ?")
  public void executeEveryMinute() {
    CompletableFuture.runAsync(() -> {
      try {
        taskService.run();
      } catch (Exception e) {
      }
    });
  }
}
